 <{extends file="<{$tempdir}>/public/shopcenter.html"}>   
<{block name=extendjs}>
  <script type="text/javascript" language="javascript" src="<{$siteurl}>/templates/<{$tempdir}>/public/js/artdialog/plugins/iframeTools.js"></script>
  <script type="text/javascript" language="javascript" src="<{$siteurl}>/templates/<{$tempdir}>/public/js/template.min.js"></script>
  <script type="text/javascript" language="javascript" src="<{$siteurl}>/templates/<{$tempdir}>/public/js/ajaxfileupload.js"> </script>
  <script>
  	var mynomenu='baseset';
  	</script>
<{/block}>
 <{block name=bodylist}>
  <!---content right start---> 
  
  
  <div class="conWaiSet fr">
        	
            <div class="shopSetTop">
            	<span>店铺设置</span>
            </div> 
            	  <{include file="<{$tempdir}>/shopcenter/usereditmenu.html"}>  
             <div class="cl"></div>  
                <form id="loginForm" method="post" action="<{ofunc type=url link="/shopcenter/savebase"}>">
                 <div class="jutiSet">
        		     	<div class="serxuanze">
                    		<div class="xuanze_left">
                        	<span>店铺名字：</span>
                        </div>
                        <div class="dianpu_right" style="width:387px;">
                        	<input type="text" style="width:387px;" id="shopname" name="shopname" value="<{$shopinfo['shopname']}>"    />
                            
                        </div>
                        <div class="cl"></div>
                    </div>
                    <div class="serxuanze">
                    	<div class="xuanze_left">
                        	<span>接单电话：</span>
                        </div>
                        <div class="dianpu_right" style="width:387px;">
                        	<input type="text" style="width:387px;"  id="phone" name="phone" value="<{$shopinfo['phone']}>"     />
                            
                        </div>
                        <div class="cl"></div>
                    </div>
                    <div class="serxuanze">
                    	<div class="xuanze_left">
                        	<span>店铺负责人电话：</span>
                        </div>
                        <div class="dianpu_right" style="width:387px;">
                        	<input type="text" style="width:387px; "  id="maphone" name="maphone" value="<{$shopinfo['maphone']}>"  />
                            
                        </div>
                        <div class="cl"></div>
                    </div>
                    
                    <div class="upimg">
                    	<div class="file_img">
                        	 <img src="<{$shopinfo['shoplogo']}>" width="136" height="130" id="imgshow" <{if  empty($shopinfo['shoplogo'])}> style="display:none;"<{/if}>>  
                        </div>
                        <div class="file_xxiang">
                        	<input type="hidden" name="shoplogo" id="shoplogo" value="<{$shopinfo['shoplogo']}>" class="skey" style="width:150px;" > 
                     <div id="div-headpicUpload" style="display:block;"> 
		                  <form id="form1" name="form1" method="post"  enctype="multipart/form-data" target="ifr-headpic-upload" onsubmit="return checkImagetype('1');">    
		                  	<div class=""> 
		               		<input name="head" type="file" id="imgFile" style="width:70px;float:left;" name="imgFile" onchange="$('#input1').val($(this).val())"  class="curbtn">
		               		<input id="submitImg" type="button" value="上传" class="ss_sc curbtn" style="width:40px;float:left; border:1px solid #ccc;background-color:white;height:22px;line-height:12px;margin-top:5px;margin-left:20px;" >   
		               	</div>  
		               </form> 
		             </div>
		                         <div class="cl"></div>
                        </div>
                    </div>
                    
                    
                    <div class="serxuanze">
                    	<div class="xuanze_left">
                        	<span>店铺地址：</span>
                        </div>
                        <div class="dianpu_right">
                        	<input type="text" style="width:569px; " id="address" name="address" value="<{$shopinfo['address']}>" />
                            
                        </div>
                        <div class="cl"></div>
                    </div>
                    
                    <div class="serxuanze" style=" width:767px;">
                    	<div class="xuanze_left">
                        	<span>高德坐标：</span>
                        </div>
                        <div class="dianpu_right" style="width:498px; margin-right:0px; padding-right:0px;">
                        	<input type="text" style="width:488px; " name="baidumap" value="<{$shopinfo['lng']}>,<{$shopinfo['lat']}>"  />
                            
                        </div>
                        <div class="geiquAdd curbtn fr" onclick="biaoji();" >
                        	给取地址
                        </div>
                        <div class="cl"></div>
                    </div>
                    <div class="serxuanze">
                    	<div class="xuanze_left">
                        	<span>邮箱地址：</span>
                        </div>
                        <div class="dianpu_right">
                        	<input type="text" style="width:569px;" id="email" name="email" value="<{$shopinfo['email']}>" />
                            
                        </div>
                        <div class="cl"></div>
                    </div>
                    
                     <{assign var=foo value="|"|explode:$shopinfo['starttime']}>
                     <{foreach from=$foo key=myid item=items}>
                     <{if !empty($items)}>
                     <{assign var=newtime value="-"|explode:$items}>
                     <{if count($newtime) == 2}>
                     <{$newtimedata[] = $newtime[0]}>
                     <{$newtimedata[] = $newtime[1]}>
                     <{/if}>
                     <{/if}>
                     <{/foreach}>
                     <div class="serxuanze">
                         <div class="xuanze_left">
                             <span>营业时间：</span>
                         </div>
                         <div class="xuanze_right" style="width:589px;">
                             <div style="vertical-align: middle;line-height:40px;width: 569px;">
                                 <{html_select_time time=$newtimedata[0] display_seconds=0 field_array="dotime"}>&nbsp;&nbsp;--&nbsp;&nbsp;<{html_select_time time=$newtimedata[1] display_seconds=0 field_array="dotime"}>
                             </div>
                         </div>
                         <div class="cl"></div>
                     </div>
                     <div class="serxuanze" id="starttime2">
                         <div class="xuanze_left">
                             <span>营业时间：</span>
                         </div>
                         <div class="xuanze_right" style="width:589px;">
                             <div style="vertical-align: middle;line-height:40px;width: 569px;">
                                 <{html_select_time time=$newtimedata[2] display_seconds=0 field_array="dotime"}>&nbsp;&nbsp;--&nbsp;&nbsp;<{html_select_time time=$newtimedata[3] display_seconds=0 field_array="dotime"}>
                                 &nbsp;&nbsp;<a href="#" onclick="detimelist(2);">删除</a>
                             </div>
                         </div>
                         <div class="cl"></div>
                     </div>
                     <div class="serxuanze" id="starttime4">
                         <div class="xuanze_left">
                             <span>营业时间：</span>
                         </div>
                         <div class="xuanze_right" style="width:589px;">
                             <div style="vertical-align: middle;line-height:40px;width: 569px;">
                                 <{html_select_time time=$newtimedata[4] display_seconds=0 field_array="dotime"}>&nbsp;&nbsp;--&nbsp;&nbsp;<{html_select_time time=$newtimedata[5] display_seconds=0 field_array="dotime"}>
                                 &nbsp;&nbsp;<a href="#" onclick="detimelist(4);">删除</a>
                             </div>
                         </div>
                         <div class="cl"></div>
                     </div>
                     <div class="serxuanze" id="newtime">
                         <div class="xuanze_left">
                         </div>
                         <div class="xuanze_right" style="width:589px;">
                             <a href="javescript:;" onclick="outtimelist();">新增营业时间</a>
                         </div>
                         <div class="cl"></div>
                     </div>
					     <div class="serxuanze">
                    	<div class="xuanze_left">
                        	<span>默认商品单位：</span>
                        </div>
                        <div class="dianpu_right" style="width:auto; background:none; ">
                        	<input type="text" style="width:150px; float:left;" id="goodattrdefault" name="goodattrdefault" value="<{$shopinfo['goodattrdefault']}>"  /><span style="float:left; margin-left:20px;">比如：份 / 斤 / 个 / 盒</span>
                            
                        </div>
                        <div class="cl"></div>
                    </div>
					<div class="cl"></div>
                       
				  <div class="serxuanze">
                    	<div class="xuanze_left">
                        	<span>是否营业：</span>
                        </div>
                        <div class="xuanze_right">
                        	<input type="radio"   name="is_open"   value="1" <{if $shopinfo['is_open'] == 1}>checked<{/if}>/>是 <input type="radio"  name="is_open"   value="0" <{if $shopinfo['is_open'] == 0}>checked<{/if}>/>否
                        </div>
                        <div class="cl"></div>
                    </div>
					
 		
 
					
					
					
                  	 <div class="settijiao">
                    	
                          <div class="xuanze_right hc_login_btn_div" ></div>
                         
                     
                        <div class="cl"></div>
                    </div>
                    
                    
       			 </div>
              </form>  
                
                
        </div>
        <div class="cl"></div>
        
        
       
        
        
        <!---content right end---> 
  
  
   
 <!---content right start---> 
<script type="text/javascript"> 
var areagrade ='0';// ;
var defaultid = '';
 
</script> 
<script type="text/javascript">
    $('.hc_login_btn_div').click(function(){
        var shopname = $('input[name="shopname"]').val();
        var phone = $('input[name="phone"]').val();
        var address = $('input[name="address"]').val();
        var shortname = $('input[name="shortname"]').val();
        var email =$('input[name="email"]').val();
        var goodattrdefault =$('input[name="goodattrdefault"]').val();
        var IMEI = $('input[name="IMEI"]').val();
        var is_open =  $("input[name='is_open']:checked").val();
        var is_onlinepay =  $("input[name='is_onlinepay']:checked").val();
        var is_daopay =  $("input[name='is_daopay']:checked").val();

        var hour1=$("select[name='dotime[Time_Hour]']").eq(0).val();
        var Minute1=$("select[name='dotime[Time_Minute]']").eq(0).val();
        var hour2=$("select[name='dotime[Time_Hour]']").eq(1).val();
        var Minute2=$("select[name='dotime[Time_Minute]']").eq(1).val();
        if((hour1 == 0 && Minute1 == 0) || (hour2 == 0 && Minute2 == 0)){
            var alltime1='';
        }else{
            var alltime1=hour1+','+Minute1+','+hour2+','+Minute2;
        }
        var hour3=$("select[name='dotime[Time_Hour]']").eq(2).val();
        var Minute3=$("select[name='dotime[Time_Minute]']").eq(2).val();
        var hour4=$("select[name='dotime[Time_Hour]']").eq(3).val();
        var Minute4=$("select[name='dotime[Time_Minute]']").eq(3).val();
        if((hour3 == 0 && Minute3 == 0) || (hour4 == 0 && Minute4 == 0)){
            var alltime2='';
        }else{
            var alltime2=','+hour3+','+Minute3+','+hour4+','+Minute4;
        }
        var hour5=$("select[name='dotime[Time_Hour]']").eq(4).val();
        var Minute5=$("select[name='dotime[Time_Minute]']").eq(4).val();
        var hour6=$("select[name='dotime[Time_Hour]']").eq(5).val();
        var Minute6=$("select[name='dotime[Time_Minute]']").eq(5).val();
        if((hour5 == 0 && Minute5 == 0) || (hour6 == 0 && Minute6 == 0) || alltime2==''){
            var alltime3='';
        }else{
            var alltime3=','+hour5+','+Minute5+','+hour6+','+Minute6;
        }
        var starttime = alltime1+alltime2+alltime3;
        var otherlink = $('input[name="otherlink"]').val();
        var baidumap = $('input[name="baidumap"]').val();
		 
        var backinfo = ajaxback('<{ofunc type=url link="/shopcenter/useredit/datatype/json"}>',{'shopname':shopname,'IMEI':IMEI,'phone':phone,'address':address,'shortname':shortname,'email':email,'goodattrdefault':goodattrdefault,'is_open':is_open,'is_onlinepay':is_onlinepay,'is_daopay':is_daopay,'starttime':starttime,'otherlink':otherlink,'baidumap':baidumap,'maphone':$('input[name="maphone"]').val()});
        if(backinfo.flag == true)
        {
            diaerror(backinfo.content);
        }else{
            artsucces('保存成功');
            location.reload();
        }
    });
	$(".hc_login_input").change(function(j){
		var v=$(this).val();
		var p=$(this).attr("shopname"); 
		switch(p){
		case "shopname":	if(v == '' ||v == null){
			  alert('用户名不能为空'); 
			} 
		break;
		case "shortname":
		 	var patrn=/[u4e00-u9fa5]/;  
			if(v == '' ||v == null){
			  alert('店铺CODE不能为空'); 
			} 
		break; 
		case "phone":
		   if(v == '' ||v == null){
			  alert('联系电话不能为空'); 
			} 
		break;
		case "address":
		   if(v == '' ||v == null){
			  alert('联系地址不能为空'); 
			} 
		break;
		case "pwd":
			var patrn=/(.){4,16}/;  
			if(!patrn.exec(v)){
				 alert('密码是4-16位的字母、数字,区分大小写');  
			 } 
		break;
		}
	});
	$('#submitImg').click(function(){
		ajaxFileUpload();
	});
	function ajaxFileUpload()
	{
		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});
  
		$.ajaxFileUpload
		(
			{
				url:'<{ofunc type=url link="/other/userupload/type/shoplogo/datatype/json"}>',
				secureuri:false,
				fileElementId:'imgFile',
				dataType: 'json',
				data:{name:'logan', id:'id'},
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error == false)
						{ 
						 
							$('#img').val(data.msg);
 	           $('#imgshow').attr('src',data.msg);
 	                $('#imgshow').show(); 
						}else
						{
							alert(data.msg);
						}
					}else{
					  alert(data);
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)
		
		return false;

	}
	var dialogs ;
 function uploads(){  
 	  dialogs = art.dialog.open('<{ofunc type=url link="/other/userupload/func/uploadsucess/type/shoplogo"}>');
 	  dialogs.title('上传图片'); 
 }
 function uploadsucess(linkurl){
 	dialogs.close(); 
 	$('#img').val(linkurl);
 	$('#imgshow').attr('src',linkurl);
 	$('#imgshow').show(); 
}
function uploaderror(msg){
	 alert(msg);
		dialogs.close();
		uploads();
}


var ditulog;
function biaoji(){
    	mydialog = art.dialog.open(siteurl+'/index.php?ctrl=area&action=shopbaidumap',{height:'550px',width:'850px'},false);
    	//http://www.hanwoba.com/index.php?ctrl=admin&action=baidumap&id=2#
	 	 mydialog.title('设置标记高德地图位置'); 
  }
 function closemydilog(){
 	mydialog.close();
}
    $(function(){
        var newtime2="<{$newtimedata[2]}>";
        var newtime4="<{$newtimedata[4]}>";
        if(newtime2 == '' || newtime2 == null){
            $("#starttime2").hide();
        }
        if(newtime4 == '' || newtime4 == null){
            $("#starttime4").hide();
        }
        if(newtime2 != '' && newtime4 != ''){
            $("#newtime").hide();
        }
    });
    function outtimelist(){
        var starttime2=$("#starttime2").css("display");
        var starttime4=$("#starttime4").css("display");
        if(starttime2 == 'none'){
            $("#starttime2").show();
        }
        if(starttime2 != 'none' && starttime4 == 'none'){
            $("#starttime4").show();
            $("#newtime").hide();
        }
    }

    function detimelist(time){
        var starttime4=$("#starttime4").css("display");
        if(time == 2 && starttime4 == 'none'){
            $("#starttime2").hide();
            $("select[name='dotime[Time_Hour]']").eq(2).val(0);
            $("select[name='dotime[Time_Minute]']").eq(2).val(0);
            $("select[name='dotime[Time_Hour]']").eq(3).val(0);
            $("select[name='dotime[Time_Minute]']").eq(3).val(0);
            $("#newtime").show();
        }else if(time == 4){
            $("#starttime4").hide();
            $("select[name='dotime[Time_Hour]']").eq(4).val(0);
            $("select[name='dotime[Time_Minute]']").eq(4).val(0);
            $("select[name='dotime[Time_Hour]']").eq(5).val(0);
            $("select[name='dotime[Time_Minute]']").eq(5).val(0);
            $("#newtime").show();
        }else{
            alert('删除顺序错误');
        }
    }
	function setmap(mylnglat,mymapname){
		$('input[name="baidumap"]').val(mylnglat);
	}
</script> 
 
 <{/block}>